﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>


<!-- 文件上传需要的样式 -->

<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>

<title></title>
</head>
<body>
<form class="form form-horizontal" method="post" style="display: none;"
	enctype="multipart/form-data" target="blankFrame" action="${path }/resource/plugin/kindeditor/zking_upload_json.jsp?fileType=image&flag=img_1&hiddenId=photo">

	<input id="fileText" type="file" multiple name="file-1"
		onchange="fileChange()" /> <input type="submit" id="submitBtn" />
</form>
<iframe src="" name="blankFrame" id="blankFrame"
	style="height: 100px; width: 100px; display: none;"> </iframe>

<div class="ibox-content">
	<form class="form-horizontal" id="dataform"
		onsubmit="javascripr:return false;">
		<c:if test="${user ne null }">
			<input type="hidden" name="id" value="${user.id }">
		</c:if>
		<input type="hidden" name="photo" value="${user.photo }" id="photo">
		<div class="form-group">
			<label class="col-sm-2 control-label">头像</label>
			<div class="col-sm-4">
				<c:if test="${user.photo eq null or user.photo eq ''}">
					<img width="150" 
						src="${path}/resource/images/profile_small.jpg" id="img_1" class="" />
				</c:if>
				<c:if test="${user.photo ne null and user.photo ne ''}">
					<img width="150" id='img_1' src="${user.photo}" class="" />
				</c:if>
			</div>

		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">员工姓名</label>
			<div class="col-sm-4">
				<input type="text" dataType="*1-20" class="form-control" name="name"
					value="${user.name}">
				<div class="Validform_checktip"></div>
			</div>
			<label class="col-sm-2 control-label">性别</label>
			<div class="col-sm-4">
				<select class="form-control" size="1" name="sex">
					<option
						<c:if test="${user.sex eq '女' }"> selected="selected" </c:if>
						value='女'>女</option>
					<option
						<c:if test="${user.sex eq '男' }"> selected="selected" </c:if>
						value='男'>男</option>

				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">身份证号码</label>
			<div class="col-sm-4">
				<input type="text"  id="idcard" class="form-control"
					name="idcard" dataType="idCard"  value="${user.idcard}" errormsg="18位必须是正确身份证，15位年月日必须合理" ignore="ignore">
					<div class="Validform_checktip"></div>
			</div>
			<label class="col-sm-2 control-label">联系电话</label>
			<div class="col-sm-4">
				<input type="text" dataType="m" class="form-control"
					value="${user.tel }"  name="tel" errormsg="输入正确的手机号码"  ignore="ignore">
				<div class="Validform_checktip"></div>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">住址</label>
			<div class="col-sm-4">
				<input type="text" dataType="*1-100" class="form-control"
					value="${user.address }" name="address" ignore="ignore">
				<div class="Validform_checktip"></div>
			</div>
			<label class="col-sm-2 control-label">生日</label>
			<div class="col-sm-4">
				<input type="text" class="form-control  datetimepicker"
					style="display: inline;" name="birthday"
					value='<fmt:formatDate value="${user.birthday}" pattern="yyyy-MM-dd"/>'>
				<div class="Validform_checktip"></div>
			</div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">我的故事点数</label>
			<div class="col-sm-4">
			    <div class="static-form-control" style="padding-top: 6px;">
				${user.jobTitle }
				</div>
			</div>
			<label class="col-sm-2 control-label">我的经验等级</label>
			<div class="col-sm-4">
			   <div class="static-form-control" style="padding-top:6px;">
				${user.grade }
				<!--隐藏的文本域，在提交之前获取当前页面代码。方便在后台查看是否进行了非法的操作input  -->
			<!-- 	<textarea rows="100" cols="100" name="reqHtml"  id="reqHtml"  style="display:none"></textarea> -->
				</div>
			</div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">我的金币</label>
			<div class="col-sm-4">
				<div class="static-form-control" style="padding-top: 6px;">
				${user.age }
				</div>
			</div>
			
		</div>
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="sub()"
					class="btn btn-success radius">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
	$('.datetimepicker').datetimepicker({
		format : "yyyy-mm-dd",
		startView : 2,
		maxView : 3,
		minView : 2
	});
	var myForm = MForm.initForm({
		invokeUrl : "${path}/admin/modifyMyInfo",
	});

	//绑定点击事件
	$("#img_1").click(function() {
		$("#fileText").trigger("click");
	});
	function sub(){
		//拿到index页面头像的img
		window.parent.document.getElementById("indexphoto").src = $("#photo").val();
		/* var html=document.documentElement.outerHTML;
		$("#reqHtml").val(html); */
	 	myForm.submit();
	}
	//检测文件改变事件
	function fileChange() {
		if ($("#fileText").val() == '') {
			return;
		}
		$("#img_1").attr("src", basePath + "/resource/images/loadingbig.gif");
		$("#submitBtn").trigger("click");
		
	}
	/**
	 开始上传图片
	 **/
	function setPhoto() {
		console.log('开始上传图片');
		$("#photo").val($('#img_1').attr('src'));
	}
</script>
</body>
</html>